 <%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>公司考试-考试试卷</title>
<script type="text/javascript" src="static/easyui/jquery.min.js"></script>
<script type="text/javascript" src="static/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="static/easyui/locale/easyui-lang-zh_CN.js"></script>
<link rel="stylesheet" href="static/easyui/themes/icon.css">
<link rel="stylesheet" href="static/easyui/themes/metro-red/easyui.css">
</head>
<body>
<style type="text/css">
.test-one{
		height:30px;
		margin:10px auto;
		display: block;
		font-size:13px;
}
.test-title{
		width:100px;
		height:20px;
		float:left;
		font-size:13px;
		margin-left:30px;
		margin-top:8px;
}
.test-serach{
		width:300px;
		height:20px;
		float:left;
		margin-top:5px;
}
		.bianji{
		background-color:#1AB394;
		color:white;
		border:none;
		width:50px;
		height:20px;
		margin-left:10px;
		cursor: pointer;
	}
.chakan{
		background-color:#1AB394;
		color:white;
		border:none;
		width:100px;
		height:20px;
		margin-left:10px;
		cursor: pointer;
}
	.icon-test-chakan{
		padding-left: 20px;
		background:url('static/easyui/themes/icons/chakan.png') no-repeat 5% 50%;
		background-color:#1AB394;
	}
		.testqy,.testbqy{
		background-color:#1AB394;
		color:white;
		border:none;
		width:50px;
		height:20px;
		cursor: pointer;
		margin-left:10px;
	}
#test{
		width: 100%;
		margin:auto;
	    overflow-x: auto;
	    margin-top: 5px;
	    border-collapse: collapse;
	    border: 1px solid #e4e7ec;
	    background-color: #fff;
   		color: gray;
   		font-size:12px; 
	}
	#test thead{
		color: #19AA8D;
	    font-size: 14px;
	    font-weight: 700;
	} 
	#test th{
		background: #6666661a;
	}
	#test td{
		border: 1px solid #e4e7ec;
		width: 150px;
		height: 50px;
	}
.datagrid-header-row td{
		background: #E6E6E6;
		color: #19AA9C;
	    font-size: 14px;
	    font-weight: 700;
	    text-align: center;
	}
	.datagrid-row td{
		background: #fff;
		font-size: 12px;
		text-align: center;
	}		
		ul li{
	list-style:none;
}
#testconpany-bianji{
	width:620px;
	height:190px;
	border:solid 1px #DADADA;
	margin:auto;
}
.insert-contents{
	width:600px;
	height:130px;
	margin-top:10px;
}
#insert-left{
	width:280px;
	height:130px;
	float:left;
	margin-left:40px;
}
#insert-right{
	width:270px;
	height:130px;
	float:right;
}
.leftone,.rightone{
	width:290px;
	height:25px;
	margin-top:10px;	
}
#creater{
	margin-left:12px;
}
.insert-oprate{
	width:190px;
	height:25px;
	float:right;
	margin-top:10px;
}
#zhisz{
	margin-left:12px;
}
#thems{
	margin-left:25px;
}
.button-no{
	width:60px;
	height:20px;
	color:white;
	border:none;
	cursor:pointer;
}
.button-ok{
	width:60px;
	height:20px;
	margin-left:10px;
	color:white;
	border:none;
	cursor:pointer;
}
#inserttest{
	width:40px;
	height:20px;
	margin-left:10px;
	color:white;
	border:none;
	float:left;
	cursor:pointer;
}
#renwu{
	width:40px;
	height:20px;
	margin-left:-10px;
	color:white;
	border:none;
	float:right;
	cursor:pointer;
}
.icon-conpany-xinzeng{
		padding-left: 20px;
		border:none;
		background:url('static/easyui/themes/icons/edit_add.png') no-repeat 5% 50%;
}
.icon-conpany-renwu{
		padding-left: 20px;
		border:none;
		background:url('static/easyui/themes/icons/renwu.png') no-repeat 5% 50%;
}
.icon-conpany-quxiao{
		padding-left: 20px;
		background:url('static/easyui/themes/icons/quxiao.png') no-repeat 5% 50%;
		background-color:#55BEA9;
}
.icon-test-bianji{
		padding-left: 20px;
		background:url('static/easyui/themes/icons/bianji.png') no-repeat 5% 50%;
		background-color:#55BEA9;
}
.icon-conpany-queding{
		padding-left: 20px;
		background:url('static/easyui/themes/icons/queding.png') no-repeat 5% 50%;
		background-color:#55BEA9;
}
.icon-test-quxiao{
		padding-left: 20px;
		background:url('static/easyui/themes/icons/quxiao.png') no-repeat 5% 50%;
		background-color:#55BEA9;
}
.icon-test-queding{
		padding-left: 20px;
		background:url('static/easyui/themes/icons/queding.png') no-repeat 5% 50%;
		background-color:#55BEA9;
}
#wheathertest,#wheathertestqx{
		width:400px;
		height:100px;
		margin:auto;
}
.ask{	
		width:400px;
		height:30px;
		margin:auto;
		text-align:center;
		color:#1AB394;
		font-size:15px;
		line-height:30px;
}
.answer{
		width:180px;
		height:30px;
		margin:20px auto;
}
#answeryestest,#answernotest,#testansweryes,#testanswerno{
		width:60px;
		height:25px;
		cursor: pointer;
		margin-left: 20px;
		background-color:#1AB394;
		color:white;
		border:none;
}
.hide{
	display: none;
}
.bioanniu{
	margin-right:10px;
	width:100px;
	height:30px;
	float:right;
}
#testclose{
	width:60px;
	background-color:#17AA8D;
	cursor: pointer;
	color:white;
}
#tdate{
	width:173px;
	height:21px;
}
</style>
<script type="text/javascript">
function add(text){   
	$("#content-admin").panel({
		href:text
	})
}	
//查询表格
function searchtest(name){
	$("#test").datagrid({
		url:'select-test',
	    queryParams:{
	    	ttestname:name
	    },
	    columns:[[
	    	{field:'aa',checkbox:true,title:'选择',width:100},
	    	{field:'ttestid',hidden:true,title:'编号',width:150},
	    	{field:'test',title:'序号',width:60},
	    	{field:'ttestname',title:'试卷名称',width:200},
	    	{field:'ttesttheme',title:'主题',width:240},
	    	{field:'ttestledge',title:'知识组',width:220},
	    	{field:'Staff_name',title:'创建人',width:80},
	    	{field:'ttesttnums',title:'考试时长',width:80},
	    	{field:'ttestavrage',title:'试卷总分',width:80},
	    	{field:'ttestdate',title:'创建日期',width:160,align:'center',
	    		formatter:function(val,rec){
					return formattime(val);
		        }
	    	},
	    	{field:'caozuo',title:'操作',width:120,align:'center',
				formatter: function(value,row,index){ 
					var qiy="";
					if(row['ttestid']==0){
						qiy="启用";
					}else{
						qiy="禁用"
					}
					return "<input type='button' class='chakan icon-test-chakan' onclick='conpanychakan("+row['ttestid']+")' style='width:80px;height: 20px;font-size:12px;border-radius:4px;color:#fff;background-color:#18A689;cursor: pointer;' value='查看试卷'/>";
				}
			},
	    	]],	
	    	pagination:true,
		    pageNumber:1,
		    pageSize:5,
		    pageList:[5,10,15]  
	});
}

//搜索
function checktest(value,name){ 
	searchtest($(".easyui-searchbox").val());
}
$(function(){
	searchtest(null);
});

//点击新增按钮到新增界面
$("#inserttest").click(function(){
	add("testinsert");
});
//点击新增考生按钮到新增界面
$("#renwu").click(function(){
	add("inserttestpeople");
});

//点击查看试卷按钮到查看试卷的界面
function conpanychakan(id){
	$("#content-admin").panel({
		href:"looktest?id="+id
	})
};

$("#zhezhao").hide();	
//编辑按钮
function conpanybianji(id){
	$("#testconpany-bianji").window("open");
	$("#zhezhao").show();
	$.ajax({
		url:"test-all",
		type:"get",
		dateType:"json",
		data:{ttestid:id},
		success: function (result) {
			$("#ttestid").val(result[0]["ttestid"]);
			//名称
            $("#tname").val(result[0]["ttestname"]);
			//主题
            $("#tthem").val(result[0]["ttesttheme"]);
			//知识组
            $("#tzhi").val(result[0]["ttestledge"]);
			//时长
            $("#ttime").val(result[0]["ttesttnums"]);
			//日期
            $("#tdate").datetimebox("setValue",result[0]["ttestdate"]);
        }
	});
	//点击确定
	$("#conpany-ok").click(function(){
		var id = $("#ttestid").val()
		var name = $("#tname").val();
		var them = $("#tthem").val();
		var zhi = $("#tzhi").val();
		var date = $("#tdate").val();
		var time = $('#ttime').val(); 
		 $.ajax({
			url:"test-xiugai",
			type:"post",
			data:{
				"ttestid":id,
				"ttestname":name,
				"ttesttheme":them,
				"ttestledge":zhi,
				"ttestdate":date,
				"ttesttnums":time
			},
			success:function(result){	
				
			}
		}); 
		$("#testconpany-bianji").window("close");
		 $("#zhezhao").hide();
	});
}
	/*点击编辑中的确定*/
/* 	$("#conpany-ok").click(function(){
		$("#testconpany-bianji").window("close");
		 $("#zhezhao").hide();
	}); */
	
	/*点击编辑中的取消*/
	$("#conpany-no").click(function(){
		$("#testconpany-bianji").window("close");
		 $("#zhezhao").hide();
	});
	
	//点击录用按钮弹框
	function testqy (){
		$("#wheathertest").window("open");
	}
	//点击取消按钮
	   $("#testanswerno").click(function(){
		   $("#wheathertest").window("close");
	   }); 
	 //点击确定按钮
	   $("#testansweryes").click(function(){
		   $("#wheathertest").window("close");
		   $(".testqy").addClass("hide");
			$(".testbqy").removeClass("hide");
	   }); 
	 
		//点击不录用按钮弹框
		function testbqy (){
			$("#wheathertestqx").window("open");
		}
		//点击取消按钮
		   $("#answernotest").click(function(){
			   $("#wheathertestqx").window("close");
		   }); 
		 //点击确定按钮
		   $("#answeryestest").click(function(){
			   $("#wheathertestqx").window("close");
			   $(".testbqy").addClass("hide");
				$(".testqy").removeClass("hide");
		   });
		   //时间转换
			function formattime(value,row,index){
				var date = new Date(value);
				        var year = date.getFullYear().toString();
				        var month = (date.getMonth() + 1);
				        var day = date.getDate().toString();
				        var hour = date.getHours().toString();
				        var minutes = date.getMinutes().toString();
				        var seconds = date.getSeconds().toString();
				        if (month < 10) {
				            month = "0" + month;
				        }
				        if (day < 10) {
				            day = "0" + day;
				        }
				        if (hour < 10) {
				            hour = "0" + hour;
				        }
				        if (minutes < 10) {
				            minutes = "0" + minutes;
				        }
				        if (seconds < 10) {
				            seconds = "0" + seconds;
				        }
				        return year + "-" + month + "-" + day + " " + hour + ":" + minutes + ":" + seconds;
			}	
		   
</script>
	<div class="mytest">
		<div class="test-one">
			<div class="test-title">
					<button id="inserttest" class="xztest icon-conpany-xinzeng"></button>
					<button id="renwu" class="xzrenwu icon-conpany-renwu"></button>
			</div>
			<div class="test-serach">
				<input class="easyui-searchbox" searcher="checktest"  style="width:240px" data-options="prompt:'名称'"></input>
			</div>
		</div>
		<div class="test-two">
			<table id="test" class="easyui-datagrid" data-options="height:300"></table>
		</div>
 </div>
 
<!-- 修改弹框 -->
 	<div id="zhezhao" style="width:1366px;height:736px;position:fixed; top:0px;background: rgba(0, 0, 0, 0.5);
 	text-align:center;left:0;z-index:10;display:none;" >
 		<div id="testconpany-bianji" class="easyui-window" title="考试试卷" 
 		data-options="closed:true,minimizable:false,maximizable:false,collapsible:false">
		<div class="insert-contents">
		<input type="hidden" id="ttestid"/>
		<form id="insert-left">
			<div class="leftone"><span>名称：</span><input id="tname" type="text" name="ttestname" value="${pojos.ttestname }"></div>
			<div class="leftone"><span>时长：</span><input id="ttime" type="text" name="ttesttnums" value="${pojos.ttesttnums }"></div>
			<div class="leftone"><span>主题：</span><input id="tthem" type="text" name="ttesttheme" value="${pojos.ttesttheme }"></div>
		</form>
		<form id="insert-right">
			<div class="rightone"><span id="zhisz">知识组：</span><input id="tzhi" type="text" name="ttestledge" value="${pojos.ttestledge }"></div>
			<div class="rightone"><span>创建日期：</span><input id="tdate" type="text"class="easyui-datetimebox" data-options="required:true,showSeconds:false" name="ttestdate" value="${pojos.ttestdate }"></div>
		</form>
	</div>
		<div class="insert-oprate">
			<button id="conpany-no" class="button-no icon-conpany-quxiao">取消</button>
			<button id="conpany-ok" class="button-ok icon-conpany-queding">确定</button>
		</div>
	</div>
</div>
</body>
</html>